-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BREAKING: better json encoding + marshalling/unmarshalling #34
Conversation
I think across Testground we are mostly using snake_case for JSON encoded values, maybe use that here as well instead of camelCase. |
Hmmmm... The thing is: this are values that the developer/user has to write. And JavaScript translates literally to JSON. And JavaScript is, by default, camelCase 🐪 . This is the smallest change subset I can make. I'm not using it for now and I'm leaving this as a draft until I'm sure the sdk-js works correctly. After that, I'll take a look at this again. This piece of code of the example I'm building: It's a bit odd to see that the network configuration is literally the only thing that is not camel case. It could induce in errors. We could also have a simple function on the sdk-js side of things that would convert the object to match the current sdk-go version too! That wouldn't be a problem either! Nevertheless, I think testground/testground should be the repository dictating the format, and not sdk-go! It's easier to keep track. |
The upper case is a side effect of default Go JSON serialisation. I'm happy to normalise with the rest of our JSON schemas, which use snake case :-) camelCase is 🤮 for API endpoints. |
(Implementing a function to convert the casing should be simple -- there is always going to be one or another language that is aggrieved) |
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
So this is enough for me. This PR does the following to help standardize the formats:
|
Unfortunately,
sdk-go
is the source of truth for Testground on some types. Right now I'm just changing the names in the JSON encoding so when we type them insdk-js
, we don't end up with a weird mix of capitalized and uncapitalized things. However, it is my opinion that we should move this types to the main repo!It is a breaking change because both Testground and this need to be updated in order to work.